//
//  HLLoginModel.m
//  YueYue
//
//  Created by hulu001 on 2023/5/20.
//

#import "HLLoginModel.h"
#import <SAMKeychain/SAMKeychain.h>

#define LoginServiceName @"hulu001-login-service-name-yuejiao"
#define LoginAccountName @"hulu001-login-account-name-yuejiao"

@implementation HLLoginModel


- (void)syncDataKeychain
{
    NSData *data = [self mj_JSONData];
    [[NSUserDefaults standardUserDefaults] setObject:data forKey:LoginAccountName];
}

+ (HLLoginModel *)dataWithKeychain
{
    NSData *data = [[NSUserDefaults standardUserDefaults] dataForKey:LoginAccountName];
    if (data == nil){
        return nil;
    }
    NSDictionary *dic = [data mj_JSONObject];
    return [HLLoginModel mj_objectWithKeyValues:dic];
}

+ (void)deleteWithKeychain
{
    [[NSUserDefaults standardUserDefaults] setObject:nil forKey:LoginAccountName];
}
@end
